package ZUOYE2;
import java.util.Scanner;
public class ATest {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        Person1 person1 = new Person1();
        Person2 person2 = new Person2();

        for (int i = 1; i <=3 ; i++) {
            System.out.println("请输入账号：");
            int number = sc.nextInt();
            System.out.println("请输入密码：");
            int mima = sc.nextInt();
            if ((number==person1.getZhanghao()&&mima==person1.getMima())){
                System.out.println("您已成功登录：");
                person1.show();
                return;
            }else if (number==person2.getZhanghao()&&mima==person2.getMima()){
                System.out.println("您已成功登录。。");
                person2.show();
                return;
            }else {
                System.out.println("登录失败，您还有"+(3-i)+"次机会");
            }
        }
    }
}


